// 存储本地数据
export const SetItem = (name, data) => {
  let str = null
  if (typeof data === 'object' || typeof data === 'Array') {
    str = JSON.stringify(data)
  } else {
    str = data
  }
  return localStorage.setItem(name, str)
}
// 获取本地数据
export const GetItem = (data) => {
  try {
    return JSON.parse(localStorage.getItem(data))
  } catch (err) {
    return localStorage.getItem(data)
  }
}

// 删除本地数据

export const removeItem = (key) => {
  localStorage.removeItem(key)
}
